package com.xique.blelock.model;

import android.support.annotation.NonNull;

import java.io.Serializable;

/**
 * Created by Administrator on 2018/12/27.
 */

public class HistoryMessageInfo implements Serializable, Comparable<HistoryMessageInfo> {
//    "type": 2,
//            "subType": 4,
//            "timestamp": "1545300294442",
//            "msgid": 74
    private int type;
    private int subType;
    private String timestamp;
    private int msgid;
    private MessageInfo data;

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getSubType() {
        return subType;
    }

    public void setSubType(int subType) {
        this.subType = subType;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public int getMsgid() {
        return msgid;
    }

    public void setMsgid(int msgid) {
        this.msgid = msgid;
    }

    public MessageInfo getData() {
        return data;
    }

    public void setData(MessageInfo data) {
        this.data = data;
    }

    @Override
    public int compareTo(@NonNull HistoryMessageInfo historyMessageInfo) {
        long thistime = Long.parseLong(timestamp);
        long thetime = Long.parseLong(historyMessageInfo.getTimestamp());
        return (int) (thetime - thistime);
    }
}
